let baseUrlDate = ''
let wxUrlDate = ''

// 当前平台（如 mp-weixin、app、h5）
const PLATFORM = process.env.UNI_PLATFORM
const NODE_ENV = process.env.NODE_ENV

// 判断小程序正式环境
let isReleaseMiniProgram = false
// #ifdef MP-WEIXIN
try {
	const accountInfo = uni.getAccountInfoSync()
	console.log(accountInfo, 'accountInfo');
	const envVersion = accountInfo.miniProgram.envVersion
	if (envVersion === 'release') {
		isReleaseMiniProgram = envVersion === 'release'
	} else if (envVersion === 'trial') {
		isReleaseMiniProgram = envVersion === 'trial'
	}
} catch (e) {
	isReleaseMiniProgram = false
}
// #endif

// 设置 baseUrlDate
if (PLATFORM === 'mp-weixin') {
	// 微信小程序环境
	baseUrlDate = isReleaseMiniProgram ?
		'https://human.ykpin.com' // 正式接口
		:
		'http://112.126.59.28:6134' // 开发/体验接口

	wxUrlDate = isReleaseMiniProgram ?
		'wss://human.ykpin.com/v2/chat/ws-chat' // 正式接口
		:
		'ws://192.168.110.6:8080/ws-chat' // 开发/体验接口	
} else if (PLATFORM === 'app' || PLATFORM === 'h5') {
	// App 或 H5
	baseUrlDate = NODE_ENV === 'production' ?
		'https://human.ykpin.com' :
		'http://112.126.59.28:6134'

	wxUrlDate = NODE_ENV === 'production' ?
		'wss://human.ykpin.com/v2/chat/ws-chat' :
		'ws://192.168.110.6:8080/ws-chat'
}

export {
	baseUrlDate,
	wxUrlDate
}